<html>
<head>
<meta name = "viewport" content = "initial-scale = 2.0">
<script type="text/javascript">

var site = 'http://'+self.location.host+'/';
var xmlhttp;
var index_url = site + 'json/list/sheets';
var html  ;

function refresh_index()
{
html = 'Sheets list <br><br>';
loadindex(index_url);

}


function loadindex(url){
	xmlhttp=new XMLHttpRequest();
//	xmlhttp.onreadystatechange=state_Change;
	xmlhttp.open("GET",url,false);
	xmlhttp.send(null);

	try {
		res = eval( "(" + xmlhttp.responseText + ")" );
		if (res.e == 'r1') {
			// send to login page
			location.href = site + 'gadget/login.html?continue='+location.href;
		}
		link = site + 'gadget/memo.html?';
		for (i=0;i<res.length;i++) {
			link_cur = link+'up_ss='+res[i].ss+'&up_ws='+res[i].ws;
			desc_cur = res[i].d + ' : ' + res[i].num[0] + '+' + res[i].num[1];
			if (res[i].num[0] + res[i].num[1] > 0) desc_cur = '<b>'+desc_cur+'</b>';
			html += '<a href="' + link_cur + '">' + desc_cur + '</a><br>';	
		}
		document.getElementById('body').innerHTML = html;
	} catch(e){
 	        response = xmlhttp.responseText;
          }
}



</script>
</head>
<body onload="refresh_index()">
<div id = "body">
</div>
<form>
<br>
<input name="Refresh" value="Refresh" onclick="refresh_index()" id = "refresh" type="button">
</form>

</body>
</html>
